package com.roger.myHome.controller;

import com.roger.myHome.entity.qto.LoanRry;
import com.roger.myHome.page.EUDataGridResult;
import com.roger.myHome.service.LoanService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/loan")
public class LoanController {

    @Resource
    private LoanService loanService;

    @PostMapping("/page")
    public EUDataGridResult page(@RequestParam(value="page",required=false) String page,
                                 @RequestParam(value="rows",required=false) String rows){

        LoanRry req = new LoanRry();

        req.setPage((Integer.parseInt(page) - 1) * Integer.parseInt(rows));
        req.setRows(Integer.parseInt(rows));
        return loanService.page(req);
    }

}
